home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / programm.ing / ams__l~1.zoo / src / smallgra.cc < prev    next >
Encoding:
C/C++ Source or Header  |  1993-09-05  |  2.1 KB  |  122 lines

  1. //////////////////////////////////////////////////////////////////////////////
  2. //
  3. //  This file is part of the Atari Machine Specific Library,
  4. //  and is Copyright 1992 by Warwick W. Allison.
  5. //
  6. //  You are free to copy and modify these sources, provided you acknowledge
  7. //  the origin by retaining this notice, and adhere to the conditions
  8. //  described in the file COPYING.
  9. //
  10. //////////////////////////////////////////////////////////////////////////////
  11.  
  12. #include "SmallGraphics.h"
  13. #include <linea.h>
  14.  
  15. static short Pattern[4]={0xffff,0xffff,0xffff,0xffff};
  16.  
  17. void InitSmallGraphics()
  18. {
  19.     linea0();
  20.     __aline->_LNMASK=0xffff;
  21.     __aline->_PTSIN[0]=0;
  22.     __aline->_PTSIN[1]=0;
  23.     __aline->_WMODE=0;
  24.     __aline->_LNMASK=0xffff;
  25.     __aline->_LSTLIN=-1;
  26.     __aline->_PATPTR=Pattern;
  27.     __aline->_PATMSK=4;
  28.     __aline->_MFILL=0;
  29.     __aline->_CLIP=0;
  30. }
  31.  
  32. void Colour(int C)
  33. {
  34.     __aline->_INTIN[0]=C;
  35.     __aline->_COLBIT0=C&1;
  36.     __aline->_COLBIT1=C&2;
  37.     __aline->_COLBIT2=C&4;
  38.     __aline->_COLBIT3=C&8;
  39. }
  40.  
  41. void Plot(int x, int y)
  42. {
  43.     __aline->_PTSIN[0]=x;
  44.     __aline->_PTSIN[1]=y;
  45.     __aline->_X2=x;
  46.     __aline->_Y2=y;
  47.     linea1();
  48. }
  49.  
  50. void Plot(int x, int y, int C)
  51. {
  52.     Colour(C);
  53.     __aline->_PTSIN[0]=x;
  54.     __aline->_PTSIN[1]=y;
  55.     __aline->_X2=x;
  56.     __aline->_Y2=y;
  57.     linea1();
  58. }
  59.  
  60. int ColourAt(int x, int y)
  61. {
  62.     __aline->_PTSIN[0]=x;
  63.     __aline->_PTSIN[1]=y;
  64.     return linea2();
  65. }
  66.  
  67. void Line(int x, int y)
  68. {
  69. /*
  70.     __aline->_PTSIN[2]=__aline->_PTSIN[0];
  71.     __aline->_PTSIN[3]=__aline->_PTSIN[1];
  72.     __aline->_PTSIN[0]=x;
  73.     __aline->_PTSIN[1]=y;
  74. */
  75.     __aline->_X1=__aline->_X2;
  76.     __aline->_Y1=__aline->_Y2;
  77.     __aline->_X2=x;
  78.     __aline->_Y2=y;
  79.     linea3();
  80. }
  81.  
  82. void Line(int x1, int y1, int x2, int y2)
  83. {
  84. /*
  85.     __aline->_PTSIN[0]=x1;
  86.     __aline->_PTSIN[1]=y1;
  87.     __aline->_PTSIN[2]=x2;
  88.     __aline->_PTSIN[3]=y2;
  89. */
  90.     __aline->_X1=x1;
  91.     __aline->_Y1=y1;
  92.     __aline->_X2=x2;
  93.     __aline->_Y2=y2;
  94.     linea3();
  95. }
  96.  
  97. void Rectangle(int x1, int y1, int x2, int y2)
  98. {
  99.     __aline->_PTSIN[0]=x1;
  100.     __aline->_PTSIN[1]=y1;
  101.     __aline->_PTSIN[2]=x2;
  102.     __aline->_PTSIN[3]=y2;
  103.     linea5();
  104. }
  105.  
  106. void Fill(int x, int y)
  107. {
  108.     __aline->_PTSIN[0]=x;
  109.     __aline->_PTSIN[1]=y;
  110.     lineae();
  111. }
  112.  
  113. int MaxX()
  114. {
  115.     return V_X_MAX;
  116. }
  117.  
  118. int MaxY()
  119. {
  120.     return V_Y_MAX;
  121. }
  122.